﻿CREATE proc sp_suadoituong
@TenKH nvarchar(200),
@DiaChi nvarchar(200),
@SDT char(15),
@FAX char(20),
@MST char(20),
@TenNH char(200),
@SoTK char(20),
@TenTK nvarchar(200),
@MaKH int
as
declare @dem as int
select @dem=count(*) from danhmuc_doituong where MaKH=@MaKH
if(@dem>0)
	begin
	update danhmuc_doituong
	set TenKH=@TenKH, DiaChi=@DiaChi, SDT=@SDT, FAX=@FAX,
	MST=@MST,TenNH=@TenNH,SoTK=@SoTK,TenTK=@TenTK
	where MaKH=@MaKH
	select ErrCode=1
	end
else
	begin
	select ErrCode=0
	end